home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / tek_color.pro < prev    next >
Text File  |  1997-07-08  |  2KB  |  81 lines

  1. ; $Id: tek_color.pro,v 1.5 1997/01/15 03:11:50 ali Exp $
  2. ;
  3. ; Copyright (c) 1989-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. pro tek_color, Start_index, Ncolors
  7. ;+
  8. ; NAME:
  9. ;    TEK_COLOR
  10. ;
  11. ; PURPOSE:
  12. ;    Load a color table similar to the default Tektronix 4115 color table.
  13. ;
  14. ; CATEGORY:
  15. ;    Graphics.
  16. ;
  17. ; CALLING SEQUENCE:
  18. ;    TEK_COLOR [[, Start_index] , Ncolors]
  19. ;
  20. ; INPUTS:
  21. ;    Start_index = optional starting index of palette.  If omitted,
  22. ;        use 0.
  23. ;    Ncolors = Number of colors to load.  32 is the max and the default.
  24. ; KEYWORD PARAMETERS:
  25. ;    None.
  26. ; OUTPUTS:
  27. ;    No explicit outputs.
  28. ; COMMON BLOCKS:
  29. ;    Colors.
  30. ; SIDE EFFECTS:
  31. ;    Ncolors color indices, starting at Start_index are loaded with
  32. ;    the Tektronix 4115 default color map.
  33. ; RESTRICTIONS:
  34. ;    None.
  35. ; PROCEDURE:
  36. ;    Just copy the colors.  This table is useful for the
  37. ;    display of graphics in that the colors are distinctive.
  38. ;
  39. ;    Basic colors are:  0 - black, 1 - white, 2 - red, 3 - green, 
  40. ;    4 - blue, 5 - cyan, 6 - magenta, 7 - yellow, 8 - orange, etc.
  41. ; MODIFICATION HISTORY:
  42. ;    DMS, Jan, 1989.
  43. ;    DMS, June, 1992.  Added colors common.
  44. ;    DMS, Apr, 1993, Added start_index and ncolors.
  45. ;-
  46. common colors, r_orig, g_orig, b_orig, r_curr, g_curr, b_curr
  47.  
  48. if n_elements(ncolors) le 0 then ncolors = 32
  49. if n_elements(start_index) le 0 then start_index = 0
  50.  
  51. if n_elements(r_orig) lt (ncolors + start_index) then begin
  52.     r_orig = bytscl(indgen(256), max=!d.n_colors-1, min = 0)
  53.     g_orig = r_orig
  54.     b_orig = r_orig
  55.     endif
  56.  
  57. ;    The tektronix colors
  58. r = bytscl([ 0,100,100,0,0,0,100,100,100,60,0,0,55,100,33,67, $
  59.     100,75,45,17,25,50,75,100,67,40,17,17,17,45,75,90])
  60. g = bytscl([ 0,100,0,100,0,100,0,100,50,83,100,50,0,0,33,67, $
  61.     100,100,100,100,83,67,55,33,90,90,90,67,50,33,17,9])
  62. b = bytscl([ 0,100,0,0,100,100,83,0,0,0,60,100,83,55,33,67, $
  63.     33,45,60,75,83,83,83,90,45,55,67,90,100,100,100,100])
  64.  
  65. if ncolors lt 32 then begin        ;Trim?
  66.     r = r[0:ncolors-1]
  67.     g = g[0:ncolors-1]
  68.     b = b[0:ncolors-1]
  69.     endif
  70. s = start_index < (256 - ncolors)    ;Never over top
  71.  
  72. r_orig[s] = r
  73. g_orig[s] = g
  74. b_orig[s] = b
  75.  
  76. tvlct, r_orig, g_orig, b_orig
  77. r_curr = r_orig
  78. g_curr = g_orig
  79. b_curr = b_orig
  80. end
  81.